package com.jt.service;

import com.jt.mapper.UserMapper;
import com.jt.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getUserList() {

        //利用MP获取数据库记录
        return userMapper.selectList(null);
    }

    @Override
    public void insertUser(User user) {

        userMapper.insert(user);
    }

    @Override
    public void deleteUser(Integer id) {
    //利用Mp根据主键删除数据
        userMapper.deleteById(id);
    }
    //user对象 传递了4个参数 id是主键 修改另外的3个属性
    @Override
    public void updateUser(User user) {
        userMapper.updateById(user);

    }
}
